/**
 * 初始化lowdb
 */
const low = require('lowdb');
const FileSync = require('lowdb/adapters/FileSync');

const adapter = new FileSync('./db/data.json');
const db = low(adapter);
// todo 部署时清空密码和盐
db.defaults({
  user: [
    {
      name: 'admin',
      pwd: '63591e24cab96b96b2fb29c8d3f592c0', // admin 
      salt: 'H0ZPIXS6zcZgugBGm9Jhq06cMQCA0cEw',
      group: 0
    },
    {
      name: 'guest',
      pwd: 'd4c900ccfbce8446f15c76b6602dd587', // guest
      salt: '9nq7NS5GDaE0Agu8kpMTiiIXBj6X010w',
      group: 1
    }
  ],
})
  .write();

module.exports = db;